Struct isotope_parser::prettyprint::BoxDoc [−]
pub struct BoxDoc<'a, A = ()>(_);
Implementations
impl<'a, A> BoxDoc<'a, A>
impl<'a, A> BoxDoc<'a, A>
Append the given document after this document.
pub fn concat<I>(docs: I) -> BoxDoc<'a, A> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<BuildDoc<'a, BoxDoc<'a, A>, A>>,
pub fn concat<I>(docs: I) -> BoxDoc<'a, A> where
I: IntoIterator,
<I as IntoIterator>::Item: Into<BuildDoc<'a, BoxDoc<'a, A>, A>>,
A single document concatenating all the given documents.
pub fn intersperse<I, S>(docs: I, separator: S) -> BoxDoc<'a, A> where
A: Clone,
I: IntoIterator,
S: Into<BuildDoc<'a, BoxDoc<'a, A>, A>> + Clone,
<I as IntoIterator>::Item: Into<BuildDoc<'a, BoxDoc<'a, A>, A>>,
pub fn intersperse<I, S>(docs: I, separator: S) -> BoxDoc<'a, A> where
A: Clone,
I: IntoIterator,
S: Into<BuildDoc<'a, BoxDoc<'a, A>, A>> + Clone,
<I as IntoIterator>::Item: Into<BuildDoc<'a, BoxDoc<'a, A>, A>>,
A single document interspersing the given separator S
between the given documents. For
example, if the documents are [A, B, C, ..., Z]
, this yields [A, S, B, S, C, S, ..., S, Z]
.
Compare the intersperse
method from the itertools
crate.
NOTE: The separator type, S
may need to be cloned. Consider using cheaply cloneable ptr
like RefDoc
or RcDoc
Acts as self
when laid out on multiple lines and acts as that
when laid out on a single line.
Mark this document as a group.
Groups are layed out on a single line if possible. Within a group, all basic documents with several possible layouts are assigned the same layout, that is, they are all layed out horizontally and combined into a one single line, or they are each layed out on their own line.
A softline_
acts like nil
if the document fits the page, otherwise like line_
impl<'a, A> BoxDoc<'a, A>
impl<'a, A> BoxDoc<'a, A>
The text t.to_string()
.
The given text must not contain line breaks.
The given text, which must not contain line breaks.
impl<'a, A> BoxDoc<'a, A>
impl<'a, A> BoxDoc<'a, A>
Methods from Deref<Target = Doc<'a, BoxDoc<'a, A>, A>>
Writes a rendered document to a std::io::Write
object.
Writes a rendered document to a std::fmt::Write
object.
pub fn render_raw<W>(
&self,
width: usize,
out: &mut W
) -> Result<(), <W as Render>::Error> where
W: for<'b> RenderAnnotated<'b, A> + ?Sized,
pub fn render_raw<W>(
&self,
width: usize,
out: &mut W
) -> Result<(), <W as Render>::Error> where
W: for<'b> RenderAnnotated<'b, A> + ?Sized,
Writes a rendered document to a RenderAnnotated<A>
object.
Trait Implementations
Auto Trait Implementations
impl<'a, A = ()> !RefUnwindSafe for BoxDoc<'a, A>
impl<'a, A = ()> !UnwindSafe for BoxDoc<'a, A>
Blanket Implementations
Mutably borrows from an owned value. Read more